import request from '@/utils/request';

export async function getInfoByPage(params: any) {
  return request('/api/project/getInfoByPage', {
    method: 'POST',
    data: params,
  });
}

export async function releaseProject(para: any) {
  return request('/api/project/releaseProjects', {
    method: 'POST',
    data: para,
  });
}

export async function getCustomerByPage(para: any) {
  return request('/api/basicData/getCustomerByPage', {
    method: 'POST',
    data: para,
  });
}

export async function addInfo(params: any) {
  return request('/api/project/addInfo', {
    method: 'POST',
    data: params,
  });
}

export async function updateInfo(params: any) {
  return request('/api/project/updateInfo', {
    method: 'POST',
    data: params,
  });
}

//获取项目编号
export async function getContractAndInfoCodeNext() {
  return request('/api/project/getContractAndInfoCodeNext', {
    method: 'POST',
  });
}

//暂停项目
export async function pauseOrStartProject(para: any) {
  return request('/api/project/pauseOrStartProject', {
    method: 'POST',
    params: {
      infoId: para,
    },
  });
}

//关闭项目/project/shutProject
export async function shutProject(para: any) {
  return request('/api/project/shutProject', {
    method: 'POST',
    params: {
      infoId: para,
    },
  });
}

export async function delInfo(params: any) {
  return request('/api/project/delInfo', {
    method: 'POST',
    data: params,
  });
}

//获得团队信息
export async function getProjectTeamInfos(params: any) {
  return request('/api/project/getProjectTeamInfos', {
    method: 'POST',
    params: {
      infoId: params,
    },
  });
}

//获取团队所有信息/api/project/getTeamInfos
export async function getTeamInfos() {
  return request('/api/project/getTeamInfos', {
    method: 'POST',
  });
}

//更换团队/api/project/changeProjectTeam
export async function changeProjectTeam(infoId: string, teamId: string) {
  return request('/api/project/changeProjectTeam', {
    method: 'POST',
    params: {
      infoId: infoId,
      teamId: teamId,
    },
  });
}

//获取项目付款信息/api/project/getPayInfoByInfoId
export async function getPayInfoByInfoId(infoId: string) {
  return request('/api/project/getPayInfoByInfoId', {
    method: 'POST',
    params: {
      infoId: infoId,
    },
  });
}

//更新付款信息/api/project/updatePayInfo
export async function updatePayInfo(params: any) {
  return request('/api/project/updatePayInfo', {
    method: 'POST',
    data: params,
  });
}

//上传附件
export async function uploadFileByPayInfo(para: any) {
  return request('/api/design/uploadFileByPayInfo', {
    method: 'POST',
    requestType: 'form',
    data: para.file,
    params: {
      infoId: para.infoId,
      stageName: para.stageName,
    },
  });
}

//获取付款附件/api/design/getFileByPayInfo
export async function getFileByPayInfo(params: any) {
  return request('/api/design/getFileByPayInfo', {
    method: 'POST',
    params: {
      infoId: params.infoId,
      stageName: params.stageName,
    },
  });
}

export async function synProjectInfo() {
  return request('/api/projectInfo/sync', {
    method: 'POST',
  });
}

export default { getInfoByPage, addInfo, updateInfo, delInfo, releaseProject, synProjectInfo };
